package com.zhuiYun.project.api.dynamicAudit.mapper;
import com.zhuiYun.project.api.dynamicAudit.entity.DynamicAudit;
import com.zhuiYun.project.common.mapper.BaseMapper;
import com.zhuiYun.project.util.pageUtil.PageRequest;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface DynamicAuditMapper extends BaseMapper<DynamicAudit> {
    @Select("SELECT bb.nick_name,bb.avatar_url,bb.user_name,aa.* FROM dynamic_comment aa " +
            "LEFT JOIN user bb " +
            "ON aa.user_id = bb.id " +
            "where nick_name like '%${nickName}%'" +
            "and aa.dynamic_content_flag = 0")
    @Results({
            @Result(property = "userId" , column = "user_id"),
            @Result(property = "userName" , column = "user_name"),
            @Result(property = "divId" , column = "div_id"),
            @Result(property = "replyUserId" , column = "reply_user_id"),
            @Result(property = "replyUserName" , column = "reply_user_name"),
            @Result(property = "imageId" , column = "image_id"),
            @Result(property = "commentTime" , column = "comment_time"),
            @Result(property = "dynamicContent" , column = "dynamic_content"),
            @Result(property = "dynamicContentFlag" , column = "dynamic_content_flag"),
            @Result(property = "avatarUrl" , column = "avatar_url"),
            @Result(property = "nickName" , column = "nick_name")
    })
    List<DynamicAudit> getDyamic(@Param("pageRequest") PageRequest pageRequest, @Param("nickName") String nickName);

}
